package Common;

import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import javax.servlet.http.HttpServletRequest;

@ControllerAdvice
public class ErrorHandler {
    @ExceptionHandler(value = Exception.class)
    protected String defaultHandler(HttpServletRequest req, Exception e, Model model) throws Exception{
        model.addAttribute("url",req.getRequestURL());
        model.addAttribute("exception",e);
        return "errorHandler";
    }
}
